// Package coding_round_1 26-offer-06
// @Title coding_round_1
// @Description
// @Author  == 琳琳也叫王木木 ==  2021/9/22 18:33
// @Create  2021/9/22 18:33
package coding_round_1

// 从尾到头打印列表，使用递归实现
func ReversePrint(head *ListNode) []int {
	if head == nil {
		return nil
	}
	ans := []int{}
	var recusions func(root *ListNode)
	recusions = func(root *ListNode) {
		if root == nil {
			return
		}
		recusions(root.Next)
		ans = append(ans, root.Val)
	}
	recusions(head)
	return ans
}
